package com.hxzy.shop.marketing.config;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.hxzy.shop.enums.Constants;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.context.annotation.Configuration;

import java.util.Date;

//mybatis-plus自动填充
@Configuration
public class MybatisPlusMetaObjectHandler implements MetaObjectHandler {
    @Override
    public void insertFill(MetaObject metaObject) {
        this.strictInsertFill(metaObject, "createTime", Date.class, new Date());
        this.strictInsertFill(metaObject, "isDelete", Integer.class, Constants.NOT_DELETE);
        this.strictInsertFill(metaObject, "state", Integer.class, Constants.START);
    }

    @Override
    public void updateFill(MetaObject metaObject) {
    }
}
